package com.jumper.study.admin.dto.req;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

public class LessonReq {
    @NotBlank(message="未填写课程标题")
    private String title;

    @NotNull(message="未选择分类")
    private Integer categoryId;

    @NotBlank(message="未选择封面图片")
    private String thumb;

    private String summary;

    @NotNull(message="未填写价格")
    private Integer price;

    @NotNull(message="未填写市场价格")
    private Integer marketPrice;

    private Boolean recommend;

    private String teachers;

    private Long sort;

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Integer getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(Integer categoryId) {
        this.categoryId = categoryId;
    }

    public String getThumb() {
        return thumb;
    }

    public void setThumb(String thumb) {
        this.thumb = thumb;
    }

    public String getSummary() {
        if (summary == null) {
            summary = "";
        }
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public Integer getPrice() {
        return price == null ? 0 : price * 100;
    }

    public void setPrice(Integer price) {
        this.price = price;
    }

    public Integer getMarketPrice() {
        if (marketPrice != null) {
            return marketPrice * 100;
        }
        return marketPrice;
    }

    public void setMarketPrice(Integer marketPrice) {
        this.marketPrice = marketPrice;
    }

    public Boolean getRecommend() {
        if (recommend == null) {
            recommend = false;
        }
        return recommend;
    }

    public void setRecommend(Boolean recommend) {
        this.recommend = recommend;
    }

    public String getTeachers() {
        return teachers;
    }

    public void setTeachers(String teachers) {
        this.teachers = teachers;
    }

    public Long getSort() {
        if (sort == null) {
            sort = 0l;
        }
        return sort;
    }

    public void setSort(Long sort) {
        this.sort = sort;
    }
    
}
